# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-sqlalchemy-utils
_pkgname=sqlalchemy-utils
pkgver=0.42.2
pkgrel=0
pkgdesc="Various utility functions and custom data types for SQLAlchemy"
url="https://sqlalchemy-utils.readthedocs.io/"
arch="noarch"
license="BSD-3-Clause"
depends="python3 py3-sqlalchemy"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-flexmock
	py3-psycopg2
	py3-pymysql
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/kvesteri/sqlalchemy-utils/archive/refs/tags/$pkgver.tar.gz"
# Many checks require test database
# TODO: Figure out how to create user-space pgsql test db
options="!check"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
54b770cbde6a7131229bc1b5166dd476a4ba061e470b2eb9a7c23c085f80e413bafe11b3ea98d60906669c25cca19b35d4a068df59c7858b54f8e5d19ea61f3e  py3-sqlalchemy-utils-0.42.2.tar.gz
"
